<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: serial2.c File Reference</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>serial2.c File Reference</h1>Functions for working with the Serial Interface on the Make Controller Board. <a href="#_details">More...</a>
<p>

<p>
<a href="serial2_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#3ad2249053f2af0a87d54acbe2b8892f">Serial2_SetActive</a> (int index, int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the active state of the Serial subsystem.  <a href="#3ad2249053f2af0a87d54acbe2b8892f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#df7ee44e4cedb77083f4b8d4446d63ae">Serial2_GetActive</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the active state of the Serial subsystem.  <a href="#df7ee44e4cedb77083f4b8d4446d63ae"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#5f21941637a2a450a2837247dca6dfdc">Serial2_Write</a> (int index, uchar *buffer, int count, int timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write a block of data to the Serial port.  <a href="#5f21941637a2a450a2837247dca6dfdc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#53b9cbef8c6d2df68f5b952ff8c48dd5">Serial2_Read</a> (int index, uchar *buffer, int size, int timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read data from the Serial port.  <a href="#53b9cbef8c6d2df68f5b952ff8c48dd5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#c8ed4335d61042e279ab295300f917bf">Serial2_GetReadable</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of bytes in the queue waiting to be read.  <a href="#c8ed4335d61042e279ab295300f917bf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#0bd064b63fd6aec22cba41e654152053">Serial2_SetChar</a> (int index, int character)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sends a character (in the range of 0 to 255) to the write queue.  <a href="#0bd064b63fd6aec22cba41e654152053"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#7fdb5b08e20344239ed692c19b0cd871">Serial2_SetBaud</a> (int index, int baud)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the serial baud rate.  <a href="#7fdb5b08e20344239ed692c19b0cd871"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#019d3c9943ea78fe035888dee3c5c69d">Serial2_SetBits</a> (int index, int bits)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the number of bits per character.  <a href="#019d3c9943ea78fe035888dee3c5c69d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#80b007c89fdf9d3f1c72261721957c2e">Serial2_SetParity</a> (int index, int parity)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the parity.  <a href="#80b007c89fdf9d3f1c72261721957c2e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#e6d218ab74e7bc5dcb59bf8f1b96ef53">Serial2_SetStopBits</a> (int index, int stopBits)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the stop bits per character.  <a href="#e6d218ab74e7bc5dcb59bf8f1b96ef53"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#efb926e78f61334e7c870431eb94f4e8">Serial2_SetHardwareHandshake</a> (int index, int hardwareHandshake)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets whether hardware handshaking is being used.  <a href="#efb926e78f61334e7c870431eb94f4e8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#b8924ab2458531ee4110f2702ca45632">Serial2_GetChar</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a single character from the receive queue if available.  <a href="#b8924ab2458531ee4110f2702ca45632"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#2b1a6fccdb68e0d7d97a4346525438fa">Serial2_GetBaud</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the current baud rate.  <a href="#2b1a6fccdb68e0d7d97a4346525438fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#5a32fa24ff7dcd199517001a34f0fbd8">Serial2_GetBits</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of bits for each character.  <a href="#5a32fa24ff7dcd199517001a34f0fbd8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#706ae4241944021344873f1fd9bf15fc">Serial2_GetParity</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the current parity.  <a href="#706ae4241944021344873f1fd9bf15fc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#360964ddcd840dd0770c39b49c0f6c83">Serial2_GetStopBits</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of stop bits.  <a href="#360964ddcd840dd0770c39b49c0f6c83"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="serial2_8c.html#b0e12dc10a96976e0084f0214b20df91">Serial2_GetHardwareHandshake</a> (int index)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether hardware handshaking is being employed or not.  <a href="#b0e12dc10a96976e0084f0214b20df91"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions for working with the Serial Interface on the Make Controller Board. 
<p>

<p>Definition in file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="df7ee44e4cedb77083f4b8d4446d63ae"></a><!-- doxytag: member="serial2.c::Serial2_GetActive" ref="df7ee44e4cedb77083f4b8d4446d63ae" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the active state of the Serial subsystem. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>State - 1/non-zero (on) or 0 (off). </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00087">87</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="2b1a6fccdb68e0d7d97a4346525438fa"></a><!-- doxytag: member="serial2.c::Serial2_GetBaud" ref="2b1a6fccdb68e0d7d97a4346525438fa" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetBaud           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the current baud rate. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>baud </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00373">373</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="5a32fa24ff7dcd199517001a34f0fbd8"></a><!-- doxytag: member="serial2.c::Serial2_GetBits" ref="5a32fa24ff7dcd199517001a34f0fbd8" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of bits for each character. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>bits </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00391">391</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="b8924ab2458531ee4110f2702ca45632"></a><!-- doxytag: member="serial2.c::Serial2_GetChar" ref="b8924ab2458531ee4110f2702ca45632" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetChar           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a single character from the receive queue if available. 
<p>
This character is returned unsigned - i.e. having a value of 0 - 255. The return value is -1 if there is no character waiting. <dl class="return" compact><dt><b>Returns:</b></dt><dd>character from the queue or -1 if there is no character. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00343">343</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="b0e12dc10a96976e0084f0214b20df91"></a><!-- doxytag: member="serial2.c::Serial2_GetHardwareHandshake" ref="b0e12dc10a96976e0084f0214b20df91" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetHardwareHandshake           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns whether hardware handshaking is being employed or not. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>hardwareHandshake </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00445">445</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="706ae4241944021344873f1fd9bf15fc"></a><!-- doxytag: member="serial2.c::Serial2_GetParity" ref="706ae4241944021344873f1fd9bf15fc" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetParity           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the current parity. 
<p>
-1 means odd, 0 means none, 1 means even <dl class="return" compact><dt><b>Returns:</b></dt><dd>parity </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00409">409</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="c8ed4335d61042e279ab295300f917bf"></a><!-- doxytag: member="serial2.c::Serial2_GetReadable" ref="c8ed4335d61042e279ab295300f917bf" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetReadable           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of bytes in the queue waiting to be read. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>bytes in the receive queue. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00177">177</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="360964ddcd840dd0770c39b49c0f6c83"></a><!-- doxytag: member="serial2.c::Serial2_GetStopBits" ref="360964ddcd840dd0770c39b49c0f6c83" args="(int index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_GetStopBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of stop bits. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>stopBits </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00427">427</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="53b9cbef8c6d2df68f5b952ff8c48dd5"></a><!-- doxytag: member="serial2.c::Serial2_Read" ref="53b9cbef8c6d2df68f5b952ff8c48dd5" args="(int index, uchar *buffer, int size, int timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_Read           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read data from the Serial port. 
<p>
Will block for the time specified (in ms) if there are insufficient characters. Blocking can be avoided if <a class="el" href="serial2_8c.html#c8ed4335d61042e279ab295300f917bf" title="Returns the number of bytes in the queue waiting to be read.">Serial2_GetReadable( )</a> is used to determine how many characters are available to read prior to calling this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to read into. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>An integer specifying the maximum number of bytes to read. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>Time in milliseconds to block waiting for the specified number of bytes. 0 means don't wait. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>number of bytes read (&gt;=0) or error &lt;0 . </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00146">146</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="3ad2249053f2af0a87d54acbe2b8892f"></a><!-- doxytag: member="serial2.c::Serial2_SetActive" ref="3ad2249053f2af0a87d54acbe2b8892f" args="(int index, int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the active state of the Serial subsystem. 
<p>
This is automatically set to true by any call to Serial2_Write or Serial2_Read. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>An integer specifying the active state - 1 (on) or 0 (off). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>CONTROLLER_OK (=0) on success. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00056">56</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="7fdb5b08e20344239ed692c19b0cd871"></a><!-- doxytag: member="serial2.c::Serial2_SetBaud" ref="7fdb5b08e20344239ed692c19b0cd871" args="(int index, int baud)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetBaud           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>baud</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the serial baud rate. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>baud</em>&nbsp;</td><td>The desired baud rate. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00222">222</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="019d3c9943ea78fe035888dee3c5c69d"></a><!-- doxytag: member="serial2.c::Serial2_SetBits" ref="019d3c9943ea78fe035888dee3c5c69d" args="(int index, int bits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>bits</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the number of bits per character. 
<p>
5 - 8 are legal values. 8 is the default. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bits</em>&nbsp;</td><td>bits per character </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00244">244</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="0bd064b63fd6aec22cba41e654152053"></a><!-- doxytag: member="serial2.c::Serial2_SetChar" ref="0bd064b63fd6aec22cba41e654152053" args="(int index, int character)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetChar           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>character</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sends a character (in the range of 0 to 255) to the write queue. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>character</em>&nbsp;</td><td>The character to be sent. Must be 0 &lt;= c &lt; 256. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00192">192</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="efb926e78f61334e7c870431eb94f4e8"></a><!-- doxytag: member="serial2.c::Serial2_SetHardwareHandshake" ref="efb926e78f61334e7c870431eb94f4e8" args="(int index, int hardwareHandshake)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetHardwareHandshake           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>hardwareHandshake</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets whether hardware handshaking is being used. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>hardwareHandshake</em>&nbsp;</td><td>sets hardware handshaking on (1) or off (0) </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00321">321</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="80b007c89fdf9d3f1c72261721957c2e"></a><!-- doxytag: member="serial2.c::Serial2_SetParity" ref="80b007c89fdf9d3f1c72261721957c2e" args="(int index, int parity)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetParity           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>parity</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the parity. 
<p>
-1 is odd, 0 is none, 1 is even. The default is none - 0. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>parity</em>&nbsp;</td><td>-1, 0 or 1. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00270">270</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="e6d218ab74e7bc5dcb59bf8f1b96ef53"></a><!-- doxytag: member="serial2.c::Serial2_SetStopBits" ref="e6d218ab74e7bc5dcb59bf8f1b96ef53" args="(int index, int stopBits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_SetStopBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>stopBits</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the stop bits per character. 
<p>
1 or 2 are legal values. 1 is the default. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stopBits</em>&nbsp;</td><td>stop bits per character </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00295">295</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="5f21941637a2a450a2837247dca6dfdc"></a><!-- doxytag: member="serial2.c::Serial2_Write" ref="5f21941637a2a450a2837247dca6dfdc" args="(int index, uchar *buffer, int count, int timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial2_Write           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Write a block of data to the Serial port. 
<p>
Will block for the time specified (in ms) if the queue fills up. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to write from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>An integer specifying the number of bytes to write. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>Time in milliseconds to block waiting for the queue to free up. 0 means don't wait. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial2_8c-source.html#l00105">105</a> of file <a class="el" href="serial2_8c-source.html">serial2.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
